﻿package de.gameduell.framework.facebook.app {
	import de.gameduell.framework.application.Application;
	import de.gameduell.framework.application.Settings;
	import de.gameduell.framework.asset.AssetGroup;
	import de.gameduell.framework.util.FlashVars;

	import flash.display.Stage;

	public class FBBaseApp extends Application {
		
		private var view:View;
		private var controller:Controller;

		public function FBBaseApp() {			
		
		}

		override public function init(aStage:Stage, aAssets:AssetGroup, aSettings:Settings,standalone:Boolean):void {
			FlashVars.setKeyValue("app_start_timestamp", (new Date()).toUTCString());
			super.init(aStage, aAssets, aSettings, standalone);
			controller = Controller.getInstance();
			controller.baseUrl = baseURL;
			controller.parsePyramid(XML(assets.getAssetById("world_setup").data));
			controller.parseApplicationSettings(XML(assets.getAssetById("app_settings").data), baseURL);
			Controller(controller).parseCoinEvents(XML(assets.getAssetById("coinevents").data));			
			view = new View(window);
			removePreloaderScreen();
		}
	}
}